#coding=gbk
# image utility. help for load and draw images


import GameData
import pygame
import os.path 
from pygame.locals import *



def load_image(file, colorkey=-1):
    """ load an image.
        colorkey  -- transparent colour """

    file = os.path.join('Images', file)
    try:
        surface = pygame.image.load(file)
    except pygame.error:
        raise SystemExit, 'Could not load image "%s" '%(file)
    surface = surface.convert()
    if colorkey is not None:
        if colorkey is -1:
            colorkey = surface.get_at((0,0)) #top-left point as transparent color
    surface.set_colorkey(colorkey, RLEACCEL)
    return surface

def load_imagelist(*files):
    imgs = []
    for file in files:
        imgs.append(load_image(file))
    return imgs



